package main.java.study.step01;

/**
 * @author liuwenxiu
 * @Description: 类型转换
 * @date 2022-7-11 13:46
 */
public class TypeConversion {
    public static void main(String[] args) {
        
        // 隐式转换
        // 数值类类型从低到高自动转换 - byte->short->int->long->float->double
        byte b = 127;
        short s = b;
        int i=b;
        long l=b;
        float f=b;
        double d=b;
        System.out.println(s);
        System.out.println(i);
        System.out.println(l);
        System.out.println(f);
        System.out.println(d);
        
        // char类型
        // char类型向高级类型转换时，会自动转换为对应的Ascii码值
        char c = '1';
        int i2 = c;
        double d2 = c;
        System.out.println(i2);
        System.out.println(d2);
        
        

    }
}
